package com.xuecheng.content.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author hjh
 * @Description TODO
 * @since 2023/5/12
 */

@Slf4j
@Component
public class MediaServiceClientFallbackFactory implements FallbackFactory<MediaServiceClient> {
	@Override
	public MediaServiceClient create(Throwable throwable) {
		return new MediaServiceClient() {
			@Override
			public String uploadFile(MultipartFile upload, String objectName) {
				throwable.printStackTrace();
				log.debug("调用搜索发生熔断走降级方法,熔断异常:", throwable.getMessage());
				return "false";
			}
		};
	}
}
